class Solution:
    def checkInclusion(self, s1: str, s2: str) -> bool:
        len_1 = len(s1)
        len_2 = len(s2)
        if len_1 > len_2:
            return False
        a = [0 for i in range(26)]
        b = [0 for i in range(26)]
        ascii_a = ord('a')
        for i in range(len_1):
            a[ord(s1[i]) - ascii_a] += 1
            b[ord(s2[i]) - ascii_a] += 1
        if a == b :
            return True
        for i in range(len_1,len_2):
            b[ord(s2[i])-ascii_a] += 1
            b[ord(s2[i-len_1])-ascii_a] -=1
            if a == b :
                return True
        return False